﻿<Window x:Class="YsTiffConverter.SaveAllFramesWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vm="clr-namespace:YsTiffConverter.ViewModel"
    Title="Save all frames as JPEG" Height="192" Width="414" Icon="/YsTiffConverter;component/App.ico" 
        ShowInTaskbar="False" ResizeMode="NoResize" Loaded="Window_Loaded" WindowStartupLocation="CenterScreen">
    
    <Window.Resources>
        <Style TargetType="TextBlock">
            <Setter Property="Margin" Value="5,5,5,5"/>
        </Style>

        <Style TargetType="TextBox">
            <Setter Property="Margin" Value="5,5,5,5"/>
        </Style>
        
        <Style TargetType="Button">
            <Setter Property="Width" Value="55"/>
            <Setter Property="Margin" Value="5,5,5,5"/>
        </Style>

        <vm:CommandProxy x:Key="CommandSave"  Command="{Binding CommandSave}" />
        <vm:CommandProxy x:Key="CommandBrowseFolder"  Command="{Binding CommandBrowseFolder}" />
    </Window.Resources>
    
    <DockPanel LastChildFill="False">
        <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" HorizontalAlignment="Center">
            <TextBlock Text="  Folder: "/>
            <TextBlock Width="300">
                <TextBlock.Text>
                    <Binding Path="SaveFramesData.Folder"/>
                </TextBlock.Text>
            </TextBlock>
            <Button Command="{StaticResource CommandBrowseFolder}" Height="20" Width="15" Margin="5">...</Button>
        </StackPanel>
        
        <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" HorizontalAlignment="Left">
            <Label>_File name: </Label>
            <TextBox Width="100" Height="23" IsEnabled="{Binding SaveFramesData.ControlsAvailable}">
                <TextBox.Text>
                    <Binding Path="SaveFramesData.FileNamePrefix"/>
                </TextBox.Text>
            </TextBox>
            <TextBlock>-Page-nnn.jpg</TextBlock>
        </StackPanel>
        
        <StatusBar DockPanel.Dock="Bottom" Visibility="{Binding Path=SaveFramesData.ProgressBarVisibility}">
            <StatusBarItem>
                <TextBlock Text="Frame: "/>
            </StatusBarItem>
            
            <StatusBarItem>
                <TextBlock>
                    <TextBlock.Text>
                        <Binding Path="SaveFramesData.ImagePage"/>
                    </TextBlock.Text>
                </TextBlock>
            </StatusBarItem>
            
            <Separator/>
            
            <StatusBarItem>
                <TextBlock Text="File:"/>
            </StatusBarItem>
            
            <StatusBarItem>
                <TextBlock>
                    <TextBlock.Text>
                        <Binding Path="SaveFramesData.FileName"/>
                    </TextBlock.Text>
                </TextBlock>
            </StatusBarItem>
            
            <Separator/>
            
            <StatusBarItem HorizontalAlignment="Right">
                <ProgressBar Value="{Binding Path=SaveFramesData.ImagePage}" Width="60" Height="10" 
                             Name="progressBar" Minimum="1" Maximum="{Binding Path=SaveFramesData.FrameCount}"
                             Visibility="{Binding Path=SaveFramesData.ProgressBarVisibility}"/>
            </StatusBarItem>
        </StatusBar>

        <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Center" Margin="5">
            <Button Command="{StaticResource CommandSave}">Save</Button>
            <Button Name="buttonClose" Click="ButtonCloseClick" IsEnabled="{Binding SaveFramesData.ControlsAvailable}">Close</Button>
        </StackPanel>
    </DockPanel>
</Window>
